<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2016/6/28 0028
  Time: 15:21
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>登陆</title>
    <script>
        $(window).load(function () {
            $("#status").fadeOut();
            $("#preloader").delay(350).fadeOut("slow");
        });

        $(function () {
            $("form").submit(function () {
                var userPwd = document.getElementById("userPwd"); //获取密码框值
                var userPhone = document.getElementById("userPhone");  //获取手机框值
                var number = document.getElementById("number"); //获取验证码框值
                var isChecked = true;
                if (userPhone.value == null || userPhone.value == "") {
                    $("#user-name-label > .t_error").remove();
                    $("#user-name-label").append('<span class="t_error">请输入手机号码</span>');
                    isChecked = false;
                } else {
                    var pattern = /^1[3|5|7|8|][0-9]{9}$/;
                    if (!pattern.test(userPhone.value)) {
                        $("#user-name-label > .t_error").remove();
                        $("#user-name-label").append('<span class="t_error">手机号码格式不正确</span>');
                        isChecked = false;
                    }
                }
                if (userPwd.value == null || userPwd.value == "") {
                    $("#userPwd-label > .t_error").remove();
                    $("#userPwd-label").append('<span class="t_error">请输入登录密码</span>');
                    isChecked = false;
                }
                return isChecked;
            });
        });
    </script>
</head>
<body>
<%--<header>
    <h1>乐享数码店铺</h1>
    <a href="javascript:;"></a>
</header>--%>
<article class="viewports">
    <form:form modelAttribute="LoginEntity" method="post" action="${ctx}/login">
        <div class="p40 login_reg">
            <ul class="list_item2 odr3 r5 mt30">
                <li class="odr3_b" id="user-name-label">
                    <i class="ico-30 ico_user"></i>
                    <form:input path="userPhone" cssClass="i_text" placeholder="微信账号/手机号" maxlength="11"></form:input>
                        <%--<input class="i_text" type="text" value="" placeholder="微信账号/手机号">--%>
                    <form:errors path="userPhone" cssClass="t_error"></form:errors>
                </li>
                <li class="" id="userPwd-label">
                    <i class="ico-30 ico_password"></i>
                    <form:password path="userPwd" cssClass="i_text" placeholder="密码" maxlength="16"></form:password>
                        <%--<input class="i_text" type="text" value="" placeholder="密码">--%>
                    <form:errors path="userPwd" cssClass="t_error"></form:errors>
                </li>
            </ul>
            <div class="pt30">
                <button type="submit" class="i_btn b-ffaa3b cf r5 lh2">登录</button>
            </div>
        </div>
    </form:form>
</article>

</body>
</html>
